package cn.meeh.sscircle.module.base;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

import cn.meeh.sscircle.R;
import cn.meeh.sscircle.common.widget.ActionBar;

public class ActionBarBaseActivity extends FragmentActivity {

    public ActionBar actionBar;
    public ViewGroup rootView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.actionbar);
        actionBar = (ActionBar)findViewById(R.id.actionbar);
        rootView = (ViewGroup)findViewById(R.id.root_view);
    }

    @Override
    public void setContentView(int layoutResID) {
        ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        rootView.addView(getLayoutInflater().inflate(layoutResID, null), lp);
    }

    @Override
    public void setContentView(View view) {
        ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        view.setLayoutParams(lp);
        rootView.addView(view);
    }
}
